//
//  MusicNewSongCVC.m
//  YHYRealx
//
//  Created by yanghuiyan on 16/4/26.
//  Copyright © 2016年 yanghuiyan. All rights reserved.
//

#import "MusicNewSongCVC.h"

@implementation MusicNewSongCVC

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = [UIColor colorWithRed:0.00 green:0.20 blue:0.30 alpha:1.00];
        
        self.imagePic = [UIImageView new];
        [self.contentView addSubview:self.imagePic];
        
        self.labelSong = [YHYBaseLabel new];
        self.labelSong.textColor = [UIColor colorWithRed:0.88 green:0.88 blue:0.89 alpha:1.00];
        self.labelSong.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.labelSong];
        
        self.labelSinger = [YHYBaseLabel new];
        self.labelSinger.textColor = [UIColor colorWithRed:0.57 green:0.59 blue:0.62 alpha:1.00];
        self.labelSinger.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.labelSinger];
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [_imagePic mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(5);
        make.left.equalTo(self.contentView).offset(15);
        make.right.equalTo(self.contentView).offset(-15);
//        make.bottom.equalTo(self.labelSong.mas_top).offset(-5);
        make.height.equalTo(@100);

    }];
    
    [_labelSong mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_imagePic.mas_bottom).offset(10);
        make.left.equalTo(self.contentView).offset(15);
        make.right.equalTo(self.contentView).offset(-15);
        make.height.equalTo(@15);
        
    }];

    [_labelSinger mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_labelSong.mas_bottom).offset(5);
        make.left.equalTo(self.contentView).offset(15);
        make.right.equalTo(self.contentView).offset(-15);
        make.height.equalTo(@15);
        
    }];
}

- (void)setDetailModel:(MusicDetailDataModel *)detailModel {
    if (_detailModel != detailModel) {
        [_detailModel release];
        _detailModel = detailModel.retain;
    }
    _labelSong.text = detailModel.name;
    _labelSinger.text = detailModel.desc;
    [_imagePic sd_setImageWithURL:[NSURL URLWithString:detailModel.picUrl]];
    
}

- (void)setNewModel:(MusicDetailDataModel *)newModel {
    if (_newModel != newModel) {
        [_newModel release];
        _newModel = [newModel retain];
    }
    
    _labelSong.text = newModel.name;
    _labelSinger.text = newModel.desc;
    [_imagePic sd_setImageWithURL:[NSURL URLWithString:newModel.picUrl]];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
